package com.zbec.mdrs.service;

import com.zbec.mdrs.entity.report.ReportConfig;
import com.zbec.mdrs.repository.jpa.ReportConfigDao;
import com.zbec.mdrs.vo.ReportConfigVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by fxl on 2016/1/19.
 */
@Component
@Transactional
public class ReportConfigService {

    @Autowired
    private ReportConfigDao reportConfigDao;

    public  void  updateReportConfigType(ReportConfigVo vo){
        ReportConfig config=reportConfigDao.findOne(vo.getId());
        config.setType(vo.getType());
        config.setImportType(vo.getImportType());
    }

    public ReportConfig findReportConfig(){
       List<ReportConfig> list=reportConfigDao.findAll();
        if(list.size()>0){
            return list.get(0);
        }else{
            return  null;
        }
    }
}
